//
//  main.m
//  Conference Track Management
//
//  Created by Jiang on 2018/10/22.
//  Copyright © 2018 jiang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Conference.h"
#import "DataInputer.h"

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        dispatch_async(dispatch_get_global_queue(0, 0), ^{
            NSString *filpath;
            BOOL fileExisted = NO;
            while (!fileExisted) {
                printf("请输入文件路径:");
                char buffer[1000];
                scanf("%s",buffer);
                filpath = [NSString stringWithUTF8String:buffer];
                fileExisted = [[NSFileManager defaultManager] fileExistsAtPath:filpath];
                if (!fileExisted) {
                    printf("文件不存在！\n");
                }
            }
            TimeFormatter *formatter = [TimeFormatter twelveFormatter];
            Session *m_session = [[Session alloc] initWithStartTime:9 endTime:[[SessionEndTime alloc]initWithEarlist:12]];
            m_session.formatter = formatter;
            m_session.finalDo = @"Lunch";
            
            Session *af_session = [[Session alloc] initWithStartTime:13 endTime:[[SessionEndTime alloc]initWithEarlist:16 latest:17]];
            af_session.formatter = formatter;
            af_session.finalDo = @"Networking Event";
            
            NSArray *talks = [DataInputer normalTalksWithPath:filpath];
            Conference *con1 = [[Conference alloc] initWithMsession:m_session afSession:af_session talks:talks];
            [con1 print];
            CFRunLoopStop(CFRunLoopGetMain());
        });
        CFRunLoopRun();
    }
    return 0;
}
